package com.sbeam.controller;

import com.sbeam.pojo.Sort;
import com.sbeam.service.SortService;
import com.sbeam.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/sort")
public class SortController {

    @Autowired
    private SortService sortService;

    @GetMapping("/getSortList")
    public SysResult getSortList(){
        List<Sort> list = sortService.getSortList();
        if (list.isEmpty()){
            return SysResult.failed();
        }
        return SysResult.success(list);
    }

}
